//
//  ViewController.m
//  Dice
//
//  Created by iD Student on 6/26/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
@synthesize showNum;


- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    [showNum setText:@""];

}

- (void)viewDidUnload
{
    [self setShowNum:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}
-(IBAction)rollDice:(id)sender{
    num=arc4random()%6;
    switch (num) {
        case 0:
            [showNum setText:@"1"];
            break;
        case 1:
            [showNum setText:@"2"];
            break;
        case 2:
            [showNum setText:@"3"];
            break;
        case 3:
            [showNum setText:@"4"];
            break;
        case 4:
            [showNum setText:@"5"];
            break;
        case 5:
            [showNum setText:@"6"];
            break;
    }
}
-(IBAction)showDice:(id)sender{
    UIViewController *view=[self.storyboard instantiateViewControllerWithIdentifier:@"second"];
    [self presentModalViewController:view animated:YES];
}

@end
